<?php
/*   Description  of this file
*    Author king-of-war
*    Last Modified 2009-4-8
*    This class designed  for the news operation
*/
$root_path='./';
include_once $root_path.'head.php';
include_once $root_path.'smart.inc.php';
 include_once $root_path.'admin/class/news.class.php';

include_once $root_path.'class/page.php';
include_once $root_path.'/class/common.php';

/*
 *  add count
 */
 $common=new common($root_path);

$common->count_add('news');
/* init vars*/
$demo = new news($root_path);

$page=new page($root_path);


/*
*  get pages
*/
if (isset($_GET['p'])) {
	$p = $_GET['p'];
} else {
	$p = 1;
}

$pages=$page->page('news',$p);


$arr[0]=$pages['start'];
$arr[1]=$pages['size'];

/*
 *  news_get($arr,1) $arr mean range ; 1means admin
 */
 $pass=$demo->news_get($arr,0);

 $max=count($pass);

$news=array();

for($i=0;$i<$max;$i++){
	$news[$i]['id']=$pass[$i]->get_id();
	$news[$i]['title']=$pass[$i]->get_title();
	$news[$i]['images']=$pass[$i]->get_images();
	$news[$i]['comments']=$pass[$i]->get_comments();
	$news[$i]['author']=$pass[$i]->get_author();
	$news[$i]['date']=$pass[$i]->get_date();
	$news[$i]['verify']=$pass[$i]->get_verify();
}


/*
*  set templates
*/
$temp_url=$temp_url;
$smarty->assign("pages",$pages);
$smarty->assign("news",$news);
$smarty->assign("url",$temp_url);
$smarty->display("news.html");

include_once  "foot.php";

?>